#ifndef CPCAPHOST_H
#define CPCAPHOST_H

#include "pcapdev.h"
#include "pcapauth.h"

class CPCapHost : public QObject
{
    Q_OBJECT
    Q_PROPERTY(CPCapAuth *author READ author WRITE setAuthor NOTIFY authorChanged)
    Q_PROPERTY(QQmlListProperty<CPCapDev> devs READ devs)
public:
    explicit CPCapHost(QObject *parent = Q_NULLPTR);
    ~CPCapHost();

    CPCapAuth *author() const;
    void setAuthor(CPCapAuth *author);

    QQmlListProperty<CPCapDev> devs();

    Q_INVOKABLE void clearDevs();
    Q_INVOKABLE void updateDevs();

    Q_INVOKABLE CPCapDev *findDev(int inx);
    Q_INVOKABLE CPCapDev *findDev(const QString &name);

Q_SIGNALS:
    void authorChanged();
    void devsUpdated();

private:
    void clear_devs();

    CPCapAuth *m_author;
    QList<CPCapDev*> m_devs;
};

#endif // CPCAPHOST_H
